<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>上传一个成绩表吧</title>
    <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/index.css">
</head>
<body>
<div class="container">
    <div class="upload-form-container">
        <h2 class="form-title">上传一个成绩表吧</h2>

        <div class="template-info">
            <p><strong>📋 请按照模板格式组织数据：</strong></p>
            <ul>
                <li>必须包含的列：姓名、学号、考试名称、考试成绩</li>
                <li>支持多个考试成绩（按列横向展开）</li>
                <li>成绩请使用数字格式（0-100）</li>
                <li>缺考请填写"-"或"缺考"</li>
            </ul>
            <a href="template.xlsx" class="template-link" download>
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                     class="bi bi-download" viewBox="0 0 16 16">
                    <path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/>
                    <path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"/>
                </svg>
                下载Excel模板
            </a>
        </div>

        <form id="uploadForm" action="/upload" method="post" enctype="multipart/form-data">
            <div class="mb-4">
                <label for="excelFile" class="form-label">选择Excel文件</label>
                <input type="file" class="form-control" id="excelFile" name="file" accept=".xlsx,.xls" required>
            </div>

            <div class="form-check">
                <input class="form-check-input" type="checkbox" id="customGradeToggle">
                <label class="form-check-label" for="customGradeToggle">
                    自定义分值等级
                </label>
            </div>

            <div id="gradeLevelsContainer" style="display: none;" class="custom-grade-section">
                <h4>分值等级设置</h4>
                <div id="gradeLevels">
                    <div class="grade-level">
                        <div class="row g-3">
                            <div class="col-md-4">
                                <input type="text" class="form-control" name="grade_names[]"
                                       placeholder="等级名称 (如: A)">
                            </div>
                            <div class="col-md-4">
                                <input type="number" class="form-control" name="grade_min[]" placeholder="最小分数">
                            </div>
                            <div class="col-md-4">
                                <input type="number" class="form-control" name="grade_max[]" placeholder="最大分数">
                            </div>
                        </div>
                    </div>
                </div>
                <button type="button" class="btn btn-secondary" id="addGradeLevel">
                    <i class="bi bi-plus"></i> 添加等级
                </button>
            </div>

            <button type="submit" class="btn btn-primary">
                上传并分析
            </button>
        </form>
    </div>
</div>

<script src="js/bootstrap/bootstrap.bundle.min.js"></script>
<script src="js/index.js"></script>
</body>
</html>
